package org.gdpu.model;

import javax.persistence.*;
import java.util.Date;

/**
 * 资源
 * Created with IntelliJ IDEA.
 * Person: Administrator
 * Date: 13-6-4
 * Time: 上午11:41
 * To change this template use File | Settings | File Templates.
 */

@Entity
public class Resource {

    /**
   资源系统序号
     */
    private Integer resourceId;
    /**
    资源分类
     */
    private ResourceCategory resourceCategory;
    /**
    上传者
     */
    private String uploader;
    /**
    文件名
     */
    private String fileName;
    /**
        文件的相对路径
     */
    private String filePath;
    /**
    审核状态
    说明： -1表示审核失败   0表示等待审核  1表示审核通过
     */
    private Valid valid = Valid.WAIT_VALID;
    /**
    上传时间
     */
    private Date uploadTime;
    /**
    资源介绍
     */
    private String Introduction;
    /**
    下载次数
     */
    private Integer downloadTime;


    @Id
    @GeneratedValue
    public Integer getResourceId() {
        return resourceId;
    }

    public void setResourceId(Integer resourceId) {
        this.resourceId = resourceId;
    }

    @ManyToOne
    @JoinColumn(name = "category")
    public ResourceCategory getResourceCategory() {
        return resourceCategory;
    }

    public void setResourceCategory(ResourceCategory resourceCategory) {
        this.resourceCategory = resourceCategory;
    }

    public String getUploader() {
        return uploader;
    }

    public void setUploader(String uploader) {
        this.uploader = uploader;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    @Enumerated(EnumType.ORDINAL)
    @Column(length = 3, nullable = false, columnDefinition = "INT default 0")
    public Valid getValid() {
        return valid;
    }

    public void setValid(Valid valid) {
        this.valid = valid;
    }

    @Temporal(TemporalType.DATE)
    public Date getUploadTime() {
        return uploadTime;
    }

    public void setUploadTime(Date uploadTime) {
        this.uploadTime = uploadTime;
    }

    public String getIntroduction() {
        return Introduction;
    }

    public void setIntroduction(String introduction) {
        Introduction = introduction;
    }

    @Column(length = 3, nullable = false, columnDefinition = "INT default 0")
    public Integer getDownloadTime() {
        return downloadTime;
    }

    public void setDownloadTime(Integer downloadTime) {
        this.downloadTime = downloadTime;
    }


}
